package net.xdclass.product_server.service.impl;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.springframework.stereotype.Service;

import net.xdclass.product_server.domain.Product;
import net.xdclass.product_server.service.ProductService;

@Service
public class ProductServiceImpl implements ProductService{

	
	private final static Map<Integer, Product> daoMap=new HashMap<>();
	
	
	static {
		int i=1;
		daoMap.put(i, new Product(i++, 300, 9999,"iphonex" ));
		daoMap.put(i, new Product(i++, 1000, 9999,"冰箱" ));
		daoMap.put(i, new Product(i++, 300, 9999,"洗衣机" ));
		daoMap.put(i, new Product(i++, 320, 9999,"电话" ));
		daoMap.put(i, new Product(i++, 300, 9999,"汽车" ));
		daoMap.put(i, new Product(i++, 300, 9999,"椅子" ));
		daoMap.put(i, new Product(i++, 300, 9999,"java编程思想" ));
		
	}
	
	@Override
	public List<Product> listProduct() {
		// TODO Auto-generated method stub
		return new ArrayList<>(daoMap.values());
	}

	@Override
	public Product findById(int id) {
		// TODO Auto-generated method stub
		return daoMap.get(id);
	}

}
